package com.itheima.train.bi.controller;

import com.itheima.train.bi.model.dto.BIGroupCount;
import com.itheima.train.bi.model.query.BIQuery;
import com.itheima.train.bi.service.BIService;
import com.itheima.train.common.anno.Log;
import com.itheima.train.common.core.JsonResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Liang
 * @date 2022-07-18
 */
@Slf4j
@RestController
@RequestMapping(value = "/bi")
@RequiredArgsConstructor
public class BIController {
    private final BIService biService;

    @GetMapping(value = "/integral")
    @Log("组积分、组人数统计")
    public JsonResult<List<BIGroupCount>> integral(BIQuery biQuery) {
        return JsonResult.buildSuccess(biService.findIntegralByTime(biQuery));
    }
}
